Skip to content

Use correct content type #6601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged

Conversation

akatsoulas
Copy link
Collaborator

No description provided.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the content type used in flagged object handling to use the Profile model instead of the User model, ensuring that the correct content type is referenced when creating and deleting flags.

  • Updated tests in kitsune/flagit/tests/test_handlers.py to query ContentType for Profile.
  • Modified deletion logic in kitsune/flagit/handlers.py to use ContentType for Profile instead of User.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
kitsune/flagit/tests/test_handlers.py Updated tests to use Profile as the model for content type identification
kitsune/flagit/handlers.py Changed flag deletion to query Profile content type instead of User
Comments suppressed due to low confidence (2)

kitsune/flagit/tests/test_handlers.py:20

  • The tests still use UserFactory to create users while switching the content type to Profile. Ensure that the flagged user instance is actually a Profile (or has an associated Profile) to avoid potential mismatches in identifier references.
user_content_type = ContentType.objects.get_for_model(Profile)

kitsune/flagit/handlers.py:17

  • The on_user_deletion method receives a User instance but queries for Profile content type. Confirm that the deletion logic correctly handles the correspondence between a User and its Profile, or adjust the method to retrieve the Profile instance if needed.
user_content_type = ContentType.objects.get_for_model(Profile)

@akatsoulas akatsoulas merged commit 2b7d43f into mozilla:main Mar 31, 2025
2 checks passed
@akatsoulas akatsoulas deleted the flagged-deletions branch March 31, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant